class Route(object):
    """
    工艺路线
    """
    def __init__(self, route_id, route_nums, route_names,
                 equip_types, cost_time_low, cost_time_high, units, ready_times):
        self.route_id = route_id
        self.route_nums = list(map(str, [x.strip() for x in route_nums]))
        self.route_names = [x.strip() for x in route_names]
        self.equip_types = [x.strip() for x in equip_types]
        self.cost_time_low = [Route.get_mim(x) for x in cost_time_low]
        self.cost_time_high = [Route.get_mim(x) for x in cost_time_high]
        self.units = [x.strip() for x in units]
        self.ready_times = [Route.get_mim(x) if len(x) > 0 else 0 for x in ready_times]

    @classmethod
    def get_mim(cls, x):
        if len(x) > 0 and x[-1] == 'h':
            return float(x[:-1].strip()) * 60 // 1
        if len(x) > 3 and x[-3:] == 'min':
            return int(x[:-3])
        return int(x)

    def output(self):
        print("route_id: ", self.route_id)
        print("route_nums: ", self.route_nums)
        print("route_names: ", self.route_names)
        print("equips: ", self.equip_types)
        print("cost_time_low: ", self.cost_time_low)
        print("cost_time_high: ", self.cost_time_high)
        print("units: ", self.units)
        print("ready_times: ", self.ready_times)




